package org.example;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.handler.codec.http.*;
import reactor.core.publisher.Mono;
import reactor.netty.DisposableServer;
import reactor.netty.http.server.HttpServer;

import java.nio.charset.StandardCharsets;

public class WebServer2 {
    public static void main(String[] args) {
        DisposableServer server = HttpServer.create()
                .port(8080)
                .route(routes -> routes.get("/", (request, response) ->
                        response.sendString(Mono.just("Hello, World!"))))
                .bindNow();

        server.onDispose().block();
    }
}
